package com.mh.example.xml.cycle;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class ExampleBean implements BeanNameAware, BeanFactoryAware, ApplicationContextAware, InitializingBean {

	public void println() {
		System.out.println("xml >>>This is mh println method.<<<=======================");
	}

	@Override
	public void setBeanName(String name) {
		System.out.println("222 xml >>> BeanNameAware.setBeanName method. BeanName is 【" + name + "】");
	}

	@Override
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		System.out.println("333 xml >>> BeanFactoryAware.setBeanFactory");
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		System.out.println("444 xml >>> ApplicationContextAware.setApplicationContext");
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("666 xml >>> InitializingBean.afterPropertiesSet");
	}

	public void initMethod() {
		System.out.println("777 xml >>> ExampleBean.initMethod");
	}

	public void destoryMethod() {
		System.out.println("999 xml >>> ExampleBean.destoryMethod");
	}
}
